
/******************************************************************************
 *
 * jattbak - TODO
 *
 * Author:        Dennis Krzyzaniak
 * E-mail:        ebrosius@netgarage.org
 * Copyright (C): 2011 by Dennis Krzyzaniak
 *
 * This file is part of jattbak.
 *
 * jattbak is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * jattbak is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with jattbak.  If not, see <http://www.gnu.org/licenses/>.
 *
 *****************************************************************************/
#if 0
timer 8

timer 3 : 3
timer 2 : 5
timer 2 : 7
timer 1 : 8
timer 2 : 10


#endif


#ifndef __JATTBAK_TIMER_H__
#define __JATTBAK_TIMER_H__

/* =========== INCLUDES ==================================================== */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

/* =========== DEFINES ===================================================== */

/* =========== DATA TYPES ================================================== */

/** timer forwarder */
struct jbkTimer_s;
typedef struct jbkTimer_s jbkTimer_t;


/** timer type */
typedef enum {
   /** run timer only once */
   ONETIME,
   /** restart expired timer */
   PERIODIC
} jbkTimerType_t;

/* =========== PUBLIC PROTOTYPES =========================================== */

/*---------------------------------------------------------------------------*/
/**
 * Initialize the timer module.
 */
void
jbkTimerInit(
      void
      );
/*---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------*/
/**
 * Starts a given timer.
 * Returns immediately.
 */
int
jbkTimerStart(
      /** timer to start */
      jbkTimer_t* const timer,
      /** milli seconds to wait for. */
      unsigned int mSec,
      /** type of timer. */
      jbkTimerType_t timerType
      );
/*---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------*/
/**
 * Wait for a given timer.
 * Returns after timer is expired.
 */
int
jbkTimerWait(
      /** timer to wait for */
      jbkTimer_t* const timer
      );
/*---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------*/
/**
 * Cancels a given timer.
 */
void
jbkTimerCancel(
      /** timer to cancel */
      jbkTimer_t* const timer
      );
/*---------------------------------------------------------------------------*/

#endif /* __JATTBAK_TIMER_H__ */

/* ========================== END OF FILE ================================== */

/*
 * vim settings, please do not remove!
 * vim:autoindent:filetype=c:syntax=c:
 * vim:ts=3:sw=3:sts=3:expandtab:cindent:tw=75:formatoptions=croql:
 * vim600:foldmethod=syntax:
 */

